package com.red.star.wechat.data.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import javax.persistence.Id;
import java.util.Date;

/**
 * @author nofish.yan@gmail.com
 * @date 2018/8/21.
 * 页面访问数据记录实体
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = "lg_page_view")
public class PageView {

    @Id
    private String id;

    /**
     * 商场编码
     */
    @Field(value = "c_mall_code")
    private String mallCode;

    /**
     * 商场编码
     */
    @Field(value = "oms_code")
    private String omsCode;

    /**
     * 粉丝ID
     */
    @Field(value = "fans_id")
    private Integer fansId;

    /**
     * 页面地址
     */
    @Field(value = "page")
    private String page;

    /**
     * 引流人
     */
    @Field(value = "from_fans_id")
    private String fromFansId;

    /**
     * 经度
     */
    @Field(value = "longitude")
    private String longitude;

    /**
     * 纬度
     */
    @Field(value = "latitude")
    private String latitude;

    /**
     * 客户端IP
     */
    @Field(value = "ip")
    private String ip;

    /**
     * 网络
     */
    @Field(value = "network")
    private String network;

    /**
     * 机型
     */
    @Field(value = "models")
    private String models;

    /**
     * 时间(天)"yyyy-MM-dd"
     */
    @Indexed
    @Field(value = "day")
    private String day;

    /**
     * 驻留时长
     */
    @Field(value = "stay_time")
    private Long stayTime;

    /**
     * 记录创建时间
     */
    @Field(value = "create_time")
    private Date createTime;

    /**
     * 页面来源渠道
     */
    @Field(value = "channel")
    private String channel;

    public PageView(String mallCode, String omsCode, Integer fansId, String page, String longitude, String latitude, String ip, String network, String models, Date createTime, String channel) {
        this.mallCode = mallCode;
        this.omsCode = omsCode;
        this.fansId = fansId;
        this.page = page;
        this.longitude = longitude;
        this.latitude = latitude;
        this.ip = ip;
        this.network = network;
        this.models = models;
        this.createTime = createTime;
        this.channel = channel;
    }
}
